<?php
namespace app\admin\validate;

use think\Validate;

class UsersValidate extends Validate
{
    protected $rule =   [
        'id'               => 'require|number',
        'admin_id'         => 'require|number',
        'goods_id|擅长项目' => 'require',
        'cate_id'          => 'require',
        'page'             => 'require|number',
        'limit'            => 'require|number',
        'nickname'         => 'require|length:1,30',
        'phone'            => 'require|length:1,30',
    ];
    
    protected $message  =   [
        'id.require'          => 'ID必须',
        'id.number'           => 'ID必须是数字',
        'admin_id.require'    => '店铺不能为空',
        'admin_id.number'     => '店铺数据类型错误',
        'cate_id.require'     => '服务标签不能为空',
        'page.require'        => '页数不能为空',
        'page.number'         => '页数数据类型错误',
        'limit.require'       => '条数不能为空',
        'limit.number'        => '条数数据类型错误',
        'nickname.require'    => '用户昵称不能为空',
        'nickname.number'     => '用户昵称长度错误',
        'phone.require'       => '手机号不能为空',
        'phone.number'        => '手机号长度错误',
    ];
    
    protected $scene = [
        'show'         => ['id'],
        'list'         => ['page', 'limit'],
        'nicknameEdit' => ['id', 'nickname'],
        'phoneEdit'    => ['id', 'phone'],
        'edit'         => ['id', 'nickname', 'admin_id', 'phone', 'cate_id', 'goods_id'],
    ];
}